home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / TECHNICA / COMPUTER / H254.ZIP / IRITSM3S.ZIP / POLY3D-R / PROGRAM.H < prev    next >
C/C++ Source or Header  |  1992-01-12  |  4KB  |  100 lines

  1. /*****************************************************************************
  2. * Definitions for the Poly3D-R program:                                      *
  3. *****************************************************************************/
  4.  
  5. #ifndef POLY_3D_R_H
  6. #define POLY_3D_R_H
  7.  
  8. #include "irit_sm.h"
  9. #include "genmat.h"
  10. #include "iritprsr.h"
  11. #include "gif_lib.h"
  12. #include "cagd_lib.h"
  13.  
  14. #define DEFAULT_COLOR        63     /* White - in case no color is given. */
  15. #define DEFAULT_BACK_GROUND_COLOR  1         /* Blue as default back ground. */
  16. #define RGB_COLOR_GIVEN            -1    /* Or if fill RGB was given. */
  17. #define DEFAULT_NORMAL_AVG_DEGREE    30       /* Less will be averaged. */
  18. #define DEFAULT_SAMPLE_PER_SRF_AXIS    20  /* Fineness srf subdiv. control. */
  19.  
  20. #define DEFAULT_SCREEN_XSIZE    320
  21. #define DEFAULT_SCREEN_YSIZE    200
  22.  
  23. #define DEFAULT_BITS_PER_PIXEL    7
  24. #define DEFAULT_LIGHT_SOURCE    { 1.0, 3.0, 7.0 }
  25. #define DEFAULT_AMBIENT        0.3
  26.  
  27. #define DEFAULT_FINENESS    4;
  28.  
  29. typedef struct ShadeInfoStruct {
  30.     int SubSamplePixel;
  31.     int BitsPerPixel;         /* 2^BitsPerPixel == number of colors possible. */
  32.     int LevelsPerColor;        /* Number of levels per each required color. */
  33.     int DefaultColor;
  34.     int BackGroundColor;
  35.     int TwoSources;  /* If true - two sources at opposite direction assumed. */
  36.     int ScrnXSize;                   /* Rendered image dimensions. */
  37.     int ScrnYSize;
  38.     int Gouraud;                 /* If TRUE use Gouraud shading. */
  39.     int BackFacing;           /* If TRUE - delete back facing polygons. */
  40.     int *MinIntensityIndex;   /* Hold minimum intensity of this color index. */
  41.     GifColorType *PColorMap;
  42.     RealType LightSource[3];        /* Vector direction of light source. */
  43.     RealType Ambient;
  44.     RealType NrmlAvgDegree;
  45. } ShadeInfoStruct;
  46.  
  47. typedef struct ScanConvertStruct {
  48.     int MaxEdgeY;              /* When this edge is no longer active. */
  49.     struct IPVertexStruct *VMinY, *VMaxY; /* Which vertices form this bndry. */
  50. } ScanConvertStruct;
  51.  
  52. typedef struct PolygonScanConvertStruct {
  53.     ScanConvertStruct Bndry1, Bndry2;
  54. } PolygonScanConvertStruct;
  55.  
  56. /* The following are global setable variables (via config file poly3d-r.cfg).*/
  57. extern int GlblMore, MouseExists, GraphDriver;
  58. extern ShadeInfoStruct GlblShadeInfo;
  59.  
  60. /* Total number of polygons/vertices to scan converted, in current scene:    */
  61. extern int GlblNumOfPolys;
  62. extern int GlblNumOfVerts;
  63.  
  64. /* Used as global measure on the surfaces subdivision fineness. */
  65. extern int FineNess;
  66.  
  67. /* Amount scene was scaled up from normalized [-1..1] size on both X & Y:    */
  68. extern RealType GlblScaleUpFctr;
  69.  
  70. /* Global transformation matrix: */
  71. extern MatrixType GlblViewMat;              /* Current view of object. */
  72.  
  73. /* All polygons to be scan convert will be inserted into this hash table     */
  74. /* during the preprocessing (PrepareXXXX functions).                 */
  75. extern struct IPPolygonStruct **PolyHashTable;
  76.  
  77. /* And finally the prototypes of the Poly3D-H.c module: */
  78. IPPolygonStruct *ProcessSurfaces(CagdCrvStruct *Crvs, CagdSrfStruct *Srfs);
  79. VoidPtr MyMalloc(unsigned size);
  80. void MyFree(VoidPtr p);
  81. void MyExit(int ExitCode);
  82. void QuitGifError(void);
  83.  
  84. /* Prototypes of the PrepData.c module: */
  85. void PrepareViewData(IPObjectStruct *PObjects);
  86.  
  87. /* Prototypes of the ColorTbl.c module: */
  88. void PrepareColorTable(IPObjectStruct *PObjects);
  89.  
  90. /* Prototypes of the EvalColr.c module: */
  91. void EvalVrtxColors(IPObjectStruct *PObjects);
  92. int UpdateEqnPolygon(IPPolygonStruct *PPolygon, int SetFlipDir);
  93. int CrossProd(RealType Pt1[3], RealType Pt2[3], RealType Pt3[3]);
  94. void PrintPolyContent(IPPolygonStruct *PPoly);
  95.  
  96. /* Prototypes of the ScnCnvrt.c module: */
  97. void ScanConvertData(GifFileType *GifFile, GifFileType *GifMask);
  98.  
  99. #endif /* POLY_3D_R_H */
  100.